perm filename CURSOR.FAI[REV,MUS] blob sn#231731 filedate 1977-05-24 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE CURSOR
C00005 ENDMK
C⊗;
TITLE CURSOR

INTERNAL CURSOR

;SAIL callable routine to display a selected cursor
;	in column 1 of a selected position.


;AC's
p←←17
tmp←←0
line←←1
cmd←←1

;Line characteristics
DDDLIN←←20000
IIILIN←←400000

DEFINE CW(C1,B1,C2,B2,C3,B3) <
	<BYTE (8)<B1>,<B2>,<B3> (3)<C1>,<C2>,<C3>>!4
>

;Command names for DD command bytes
EXCT←←0;			Execute
FNCN←←1 ALPHBG←←6 ALPHA←←46;	Function
CHNL←←2;			Channel select
COLM←←3;			Column select
HILIN←←4;			Set high 5 bits of line address
LOLIN←←5			Set low 4 bits of line address

;INTERNAL PROCEDURE cursor(
;      INTEGER position, char, pog);

DEFINE posit <-3(p)>
DEFINE char <-2(p)>
DEFINE pog <-1(p)>
DEFINE nargs <3>

CURSOR:	SETO	line,
	GETLIN	line
	AOJE	line,Detchd

	TLNN	line,DDDLIN!IIILIN
	JRST	Notdpy

	JUMPL	line,IIIdpy

DDDdpy:	MOVE	tmp,[CW  FNCN,ALPHA, CHNL,0, FNCN,66]
	MOVEM	tmp,DPYPRG
	MOVE	tmp,[CW  COLM,1, HILIN,0, LOLIN,0]
	MOVEM	tmp,DPYPRG+1
	MOVN	tmp,posit
	ASH	tmp,-1
	ADDI	tmp,400
	DPB	tmp,[POINT 4,DPYPRG+1,23]
	LSH	tmp,-4
	DPB	tmp,[POINT 5,DPYPRG+1,15]

	JRST	Both

IIIdpy:	MOVE	tmp,[BYTE  (11)<-1024>,0  (3)2,2 (2)1,2 (4)6]
	MOVEM	tmp,DPYPRG+1;
	MOVE	tmp,posit
	DPB	tmp,[POINT 11,DPYPRG+1,21]

Both:	MOVE	tmp,char
	LSH	tmp,=29
	OR	tmp,[BYTE (7)0,15,12,0,0 (1)1]
	MOVEM	tmp,DPYCHR
	MOVE	cmd,[UPGIOT 0,DPYHED]
	MOVE	tmp,pog
	DPB	tmp,[POINT 4,cmd,12]
	XCT	cmd

Notdpy:
Detchd:	SUB	p,[<nargs>+1,,<nargs>+1]
	JRST	@<nargs>+1(p)


;Data blocks
DPYHED:	200000,,DPYPRG
	DPYLEN
	0
	DPYPRG+1

DPYPRG:	BLOCK	2
DPYCHR:	0
	0
DPYLEN←←.-DPYPRG

	END